#include"public.h"

#include <QFileInfo>
#include <QDir>
#include <QCoreApplication>
#include <QStandardPaths>
#ifdef Q_OS_WIN
#include <windows.h>
#include <TlHelp32.h>
#include <QColor>
#include <QFontMetrics>
#include <QImage>
#include <QPainter>
#include <QCoreApplication>
#endif
const QString getUserPath()
{
    QDir dir;

    QString strPath = QDir::homePath()+"/Documents/HumanRobot/";
    if(!dir.exists(strPath))
        dir.mkpath(strPath);
    return strPath;
}

const QString getCurrentPath()
{
    return QCoreApplication::applicationDirPath()+"/";
}

const QString getLogPath()
{
    QDir dir;
    QString strPath = QDir::homePath()+"/Documents/HumanRobot/log/";
    if(!dir.exists(strPath))
        dir.mkpath(strPath);
    return strPath;
}

bool isFileExist(QString fullFileName)
{
    QFileInfo fileInfo(fullFileName);
    if(fileInfo.isFile())
    {
        return true;
    }
    return false;
}


QString getUserTypeStr(UserType type)
{
    switch(type)
    {
    case USER_MANAGER:
        return QObject::tr("管理员");
    case USER_DEVELOPER:
        return QObject::tr("开发用户");
    case USER_OPERATOR:
        return QObject::tr("操作用户");
    default:
        return QObject::tr("未知类型");
    }
}

const QString getVideoPath()
{
    QDir dir;

    QString strPath = QDir::homePath()+"/Documents/HumanRobot/video/";
    if(!dir.exists(strPath))
        dir.mkpath(strPath);
    return strPath;
}

const QString getPhotoPath()
{
    QDir dir;

    QString strPath = QDir::homePath()+"/Documents/HumanRobot/image/";

    if(!dir.exists(strPath))
        dir.mkpath(strPath);
    return strPath;
}
